﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cn.Edwon.Web;

namespace Cn.Cellula.Website.Admin.Wuc {
    public partial class WUC_UserEditMenu : System.Web.UI.UserControl {
        protected void Page_Load(object sender, EventArgs e) {
            String uid = Request.QueryString["id"];
            this.hl_List.NavigateUrl = ClientHelper.RootUrl + "Admin/Permission/User/List.aspx";
            if (uid == null) {
                this.ph_EditMenu.Visible = false;
            } else {
                ConvertLink(ref this.hl_Contact,uid);
                ConvertLink(ref this.hl_Face, uid);
                ConvertLink(ref this.hl_Office, uid);
                ConvertLink(ref this.hl_Profile, uid);
                ConvertLink(ref this.hl_Pwd, uid);
            }
        }
        private void ConvertLink(ref HyperLink rLink,String rId) {
            if (rLink.NavigateUrl.IndexOf("http://") == -1) {
                rLink.NavigateUrl = ClientHelper.RootUrl + rLink.NavigateUrl + "?id=" + rId;
            }
            rLink.Enabled = (Request.Url.ToString().ToLower().IndexOf(rLink.NavigateUrl.ToLower()) == -1);
        }
    }
}